﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Threading.Tasks;

namespace Wombat.Data
{
    public interface IDal
    {
        Task<IDbConnection> Connect(string connectionString);
        Task<IEnumerable<T>> ExecuteReaderAsync<T>(IDbConnection conn, string query, Func<SqlDataReader, T> recordFactory);
        Task ExecuteNotQueryAsync(IDbConnection conn, string query);
        Task BulkInsertAsync<T>(IDbConnection conn, string table, IEnumerable<T> data, Func<T, string> toString);
        Task<T> ExecuteScalarAsync<T>(IDbConnection conn, string query);
        Task<IEnumerable<T>> ExecuteReaderReadAllAsync<T>(IDbConnection conn, string query, Func<SqlDataReader, T> rowConverter);
    }
}
